package org.testis.testdriver.operations;

import org.testis.testdriver.AtofEnumaration.DebuggingMode;

/**
 * This class is the base of Decorator Classes and it holds the Decorator Class 
 * that is linked to the current object.
 * 
 * @author barisergun
 */
public abstract class TestPartOperationDecorator implements TestPartOperations {

    /**
     * Holds the previous TestPart Oepration Decorator object.
     */
    protected TestPartOperations testOperation;

    /**
     * This method is used to link the Decorator Objects to each other.
     * 
     * @param op TestPartOperations decorator object that will be linked.
     */
    public void setDecorator(TestPartOperations op) {
        testOperation = op;
    }

    /**
     * This method is used to run the current Decorator object tasks. If
     * testOperation object is not null it runs its tasks.
     * 
     * @param mode Debugging Mode of the current execution.
     */
    public boolean runOperation(DebuggingMode mode) throws InterruptedException {
        if (testOperation != null) {
            return testOperation.runOperation(mode);
        } else {
            return false;
        }
    }

    
}
